package top.kaoshanji.p2ch06a;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

/**
 * 代码清单 p2ch06a-05：字符串内部化的示例
 * author kaoshanji
 * ^_^
 * create time 2025/1/17 17:35
 */
public class StringExample01 {

    private static final Logger logger = LogManager.getLogger(StringExample01.class);

    public static void main(String[] args) {
        logger.info("...代码清单 p2ch06a-05：字符串内部化的示例...");

        boolean value1 = "Hello" == "Hello";
        logger.info("...value1:{}...", value1);

        boolean value2 = (new String("Hello") == "Hello");
        logger.info("...value2:{}...", value2);

        boolean value3 = (new String("Hello").intern() == "Hello");
        logger.info("...value3:{}...", value3);


    }

}
